package com.masterclient.app.base;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;

import com.masterclient.app.R;

/**
 * 作者：sean
 * 创建时间：2017/11/3 15:11
 * 功能说明：
 */

public class CashToastDialog extends Dialog{
    private TextView tv_tag,tv_gou;
    ImageView iv;
    Context context;
    //1勾，0叉
    public CashToastDialog(@NonNull Context context) {
        super(context,R.style.MyDialog2);
        this.context = context;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_toast_cash);
        tv_tag = (TextView) findViewById(R.id.tv_tag);
        tv_gou = (TextView) findViewById(R.id.tv_gou);
        iv = (ImageView) findViewById(R.id.iv);

        Typeface iconfont = Typeface.createFromAsset(context.getAssets(), "fonts/iconfont.ttf");
        tv_gou.setTypeface(iconfont);
        tv_tag.postDelayed(new Runnable() {
            @Override
            public void run() {
                dismiss();
            }
        },3000 );
    }

    @Override
    public void show() {
        super.show();

    }

    @Override
    protected void onStart() {
        super.onStart();
        Window window = getWindow();
        WindowManager.LayoutParams windowparams = window.getAttributes();
        window.setGravity(Gravity.CENTER);
        window.setBackgroundDrawableResource(android.R.color.transparent);
        window.setAttributes(windowparams);
    }
}
